package com.le.tester.leetcode;

import java.awt.print.Pageable;
import java.util.ArrayList;
import java.util.List;

/**
 * createTime：2022/7/15 17:14
 * description：检查考勤记录
 */
public class CheckedRecord {
    public boolean checkRecord(String s) {

        int sLength = s.length();
        List<String> list = new ArrayList<>();
        for (int i = 0; i < sLength; i++) {
            list.add(String.valueOf(s.charAt(i)));
        }
        System.out.println(list.toString());

        String tempL = "L";
        String tempA = "A";
        int i = 0;
        int j;
        for (int k = 0; k < list.size(); k++) {
            if (list.get(k).equals(tempA)) {
                i = i + 1;
            }
            if (i == 2) {
                return false;
            }
            if (list.get(k).equals(tempL)) {
                j = k;
                if (list.size() - k < 3) {
                    return true;
                }
                if (list.get(j + 1).equals(tempL) && list.get(j + 2).equals(tempL)) {
                    return false;
                }
            }

        }
        return true;

    }

    public static void main(String[] args) {
        boolean ppallp = new CheckedRecord().checkRecord("LALL");
        System.out.println(ppallp);
    }
}
